/*var xiaoming  = {

    name: '小明',
    birth: 1990,
    age:function(){
        var y = new Date().getFullYear();
        return y - this.birth
    }
}

console.log(xiaoming.age());
在对象内定义函数 
*/

function getage(){

    return new Date().getFullYear() - this.birth
    
}

var xiaoming = {
    name: '小明' ,
    birth: 2002 ,
    age: getage

};  

var m = xiaoming.age()

console.log(m);











